/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package regras;

import Interfaces.CheckerRule;

/**
 *
 * @author Tainá, Ana Luiza e Amanda
 */
public class RuleLettersNumbersSymbols01 implements CheckerRule{
     public String password;

    public RuleLettersNumbersSymbols01(String password) {
        this.password = password;
    }
    
    @Override
    public int rule(){
        int total = 0;
        String senha = " "+password+" ";
        int upper = senha.split("[A-Z]").length - 1;
        int lower = senha.split("[a-z]").length - 1;
        int number = senha.split("[0-9]").length - 1;
        int symbols = senha.split("(?=[!@#$%^&*?_~])").length - 1;
        if ((upper>0 || lower>0 || number >0) && symbols>0)
            total += 2;
        
        return total;
    }
}
